from fastapi import Request

from service import UserService, SongService
from common.result.Result import Result
from common.enum import BaseEnum
from util.log import Log
from util.token import Token
from util.str import Str

async def GetRecommendSheetList(req: Request, length: int):
    try:
        if Str.isBlank(length):
            return Result.error(BaseEnum.PARAMETER_INVALID_ERROR)
        
        sheetList = await SongService.getRecommendSheetList(length)

        return Result.success(sheetList)
    except Exception as e:
        Log.error('获取推荐的 song sheet 列表异常', e)
        return Result.error(BaseEnum.SERVICE_ERROR)